Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
JavaScript function urlDecode() returns error when string includes "%%20"

I found a great function urlDecode() here - https://stackoverflow.com/a/4458580/8950583

After years of usage I have a problem with this function now.

I have text string:

{{form.Rate_%%20|%20url_encode}}

It should return:

{{form.Rate_% | url_encode}}

But it returns error like "malformed URI" because of that seqeunce "%%20"

I made a quick fix by adding .replace(/%%/g, '%25%') to the function - so now it is:

function urlDecode(str) {
    return decodeURIComponent((str+'').replace(/%%/g, '%25%').replace(/\+/g, '%20'));
}

But I am not sure if it will not cause problems in any circumstances.

Please do you thing it is safe? Or how would you handle it?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda